package com.pengcheng.taskapplication.mvp.view.activity;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.pengcheng.taskapplication.R;
import com.pengcheng.taskapplication.adapter.XSZAdapter;
import com.pengcheng.taskapplication.contants.ConstantValue;
import com.pengcheng.taskapplication.model.LicenseModel;
import com.pengcheng.taskapplication.mvp.view.widget.MyListView;
import com.pengcheng.taskapplication.net.IView;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by ZFT on 2020/10/28.
 */

public class LicenseMoveActivity extends BaseActivity implements IView{

    @BindView(R.id.tv_center_title)
    TextView tv_center_title;
    @BindView(R.id.mlv_show)
    MyListView mlv_show;

    ArrayList<LicenseModel> list =new ArrayList<LicenseModel>();
    XSZAdapter xszAdapter;
    @Override
    protected int layoutResID() {
        return R.layout.activity_xsz_list_layout;
    }

    @Override
    protected void initData() {
        tv_center_title.setText("行驶证迁移");
        for(int i=0;i<8;i++){
            LicenseModel model=new LicenseModel();
            list.add(model);
        }

        xszAdapter=new XSZAdapter(context,list);
        mlv_show.setAdapter(xszAdapter);
        xszAdapter.notifyDataSetChanged();

    }

    @Override
    public void onSuccess(String code, String msg, Object data, String actionType) {

    }

    @Override
    public void onFailed(String code, String msg) {

    }
    @OnClick({R.id.img_back,R.id.call_centre})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.call_centre:
                String phoneNumber = ConstantValue.PhoneNumber;
                Intent dialIntent =  new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber));//跳转到拨号界面，同时传递电话号码
                startActivity(dialIntent);
                break;
        }
    }
}
